package com.xhwl.logistics.controller;


import com.xhwl.common.enums.CodeEnum;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.vehicle.VehcArea;
import com.xhwl.common.query.cent.vehicle.AreaQuery;
import com.xhwl.logistics.service.IVehcAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lu.Aaron
 * @since 2021-02-08
 * @menu 车场区域
 */
//@RestController
@Api(tags = "车场区域")
@Slf4j
@RequestMapping("/area")
public class VehcAreaController {
    @Autowired
    private IVehcAreaService vehcAreaService;
    @ApiOperation(value = "车场下属区域列表",notes = "输入框有required标识的字段为必填项", response = ResultJson.class, httpMethod = "GET")
    @ResponseBody
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public ResultJson list(AreaQuery areaQuery) {
        List<VehcArea> vehcAreaList =vehcAreaService.list(areaQuery);
        return  new ResultJson(true, CodeEnum.SUCCESS.getCode(),"查询成功",vehcAreaList);
    }

    @ApiOperation(value = "区域分页",notes = "输入框有required标识的字段为必填项", response = ResultJson.class, httpMethod = "POST")
    @ResponseBody
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public ResultJson areaPage(@RequestBody AreaQuery areaQuery) {

        return  vehcAreaService.areaPage(areaQuery);
    }
}

